package com.servers.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dao.AddressDao;
import com.dao.ConsumerDao;
import com.entity.Address;
import com.entity.Consumer;
import com.servers.AddressServers;
@Service("addressServers")
public class AddressServersImpl implements AddressServers{
	@Autowired
	private  AddressDao addressDao;
	@Autowired
	private  ConsumerDao consumerDao;
	@Override
	public List<Address> getAddressInfo(int cid) {
		//查询地址表中的信息
		List<Address> alist=addressDao.QueryAddressByCid(cid);
		//查询用户表中的信息
		//Consumer consumer=consumerDao.QueryConsumerInfoByCID(cid);
		//Map<String,Object> map=new HashMap<>();
		//map.put("addressInfo", alist);//所属用户的所有地址(包括主键的默认地址)	
		return alist;
	}
	@Override
	public Address getAddressName(int cid, String address) {
		
		return addressDao.QueryAddressName(cid, address);
	}
	@Override
	public int getIndexOfNewAddress(Address address) {
		return addressDao.InsertAddressInfo(address);
	}
	@Override
	public int deleteAddress(int aid) {
		// TODO Auto-generated method stub
		return addressDao.delectAddress(aid);
	}
	@Override
	public int updateAddree(Address address) {
		// TODO Auto-generated method stub
		return addressDao.updateAddress(address);
	}
	public void setAddressDao(AddressDao addressDao) {
		this.addressDao = addressDao;
	}
	public void setConsumerDao(ConsumerDao consumerDao) {
		this.consumerDao = consumerDao;
	}

	
	
	
}
